package com.init.bootframe.business.controller;

import com.init.bootframe.business.service.ISwiperService;
import com.init.bootframe.business.vo.SwiperVO;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/swiper")
public class SwiperController {

    @Autowired
    private ISwiperService swiperService; //轮播图service

    /**
     * 分页查询轮播图信息
     * @param swiperVO
     * @return
     */
    @PostMapping("/findSwiperList")
    Map<String, Object> findSwiperList(@RequestBody SwiperVO swiperVO) {
        Map<String, Object> result = swiperService.findSwiperList(swiperVO);
        return result;
    }

    /**
     * 查询轮播图详情
     * @param swiperVO
     * @return
     */
    @PostMapping("/findSwiper")
    SwiperVO findSwiper(@RequestBody SwiperVO swiperVO) {
        return swiperService.findSwiper(swiperVO);
    }

    /**
     * 更新轮播图
     * @param swiperVO
     * @return
     */
    @PostMapping("/updateSwiper")
    Map<String, Object> updateSwiper(@RequestBody SwiperVO swiperVO) {
        Map<String, Object> result = swiperService.updateSwiper(swiperVO);
        return result;
    }

    /**
     * 前端获取轮播图
     * @param
     * @return
     */
    @PostMapping("/webs/findSwiperLists")
    List<SwiperVO> findSwiperLists() {
        SwiperVO swiperVO = new SwiperVO();
        return swiperService.findSwiperLists(swiperVO);
    }

}
